import com.sun.org.apache.bcel.internal.generic.IF_ACMPEQ;

import java.util.Scanner;

public class Computer {
    public static void main(String[] args) {
        try {
            System.out.println("请输入数字A:");
            Scanner A = new Scanner(System.in);
            String numberA = A.nextLine();

            System.out.println("请输入运算符:");
            Scanner C = new Scanner(System.in);
            String operate = C.nextLine();

            System.out.println("请输入数字B:");
            Scanner B = new Scanner(System.in);
            String numberB = B.nextLine();
            OperationFactory operationFactory = new OperationFactory();
            Operation operate1 = operationFactory.createOperate("+");
            double result = operate1.getResult(Double.valueOf(numberA), Double.valueOf(numberB));
            System.out.println(result);


        } catch (NumberFormatException e) {
//            e.printStackTrace();
            System.out.println("请输入数字");
        }catch (ArithmeticException e){
            System.out.println("除数不可以为0");
        } catch (Exception e) {
            e.printStackTrace();
        }


    }
}
